/**
 * 功能描述 卡片
 */

define(function (require, exports, module) {
	var Component = require("form");
	var store = require("store");
	var activeUser = store.get("user");
	
    var instance = {
        initComponent : function (params, widget) {
            var component = new Component({
            	 parentNode: ".J-form",
            	 show : false,
                 model: {
                     id: "form",
                     defaultButton : false,
                     layout: "3_1",
                     items: [{
                    	 name : "pkProduct",
                         type : "hidden",
                     },{
                    	 name : "version",
                         type : "hidden",
                         defaultValue:"0"
                     },{
                    	 name : "organization",
                         type : "hidden",
                         defaultValue:activeUser.organization.pkOrganization
                     },{
                    	 name : "name",
                         type : "text",
                         label : "名称",
                         validate:["required"]
                     },{
                    	 name : "checkInNum",
                         type : "text",
                         label : "入住适用人数",
                         validate:["required"]
                     },{
                    	 name : "travelNum",
                         type : "text",
                         label : "旅居适用人数",
                         validate:["required"]
                     },{
                    	 name: "communityDatas",
                         label: "服务范围",
                         type: "select",
                         key: "communityData.pkCommunityData",
                         value: "communityData.name",
                         url: "api/comorgrelation/query",
                         params: {
                             "organization.pkOrganization": activeUser.organization.pkOrganization,
                             fetchProperties:"communityData.pkCommunityData,communityData.name"
                         },
                         multi: true,
                         validate: ["required"],
                     },{
                     	name : "insurance",
                     	type : "text",
                        label : "保险项目",
                     },{
                    	 name: "isReturn",
                         type: "radio",
                         label: "可退还",
                         list: [{
                             key: "true",
                             value: "是"
                         }, {
                             key: "false",
                             value: "否"
                         }],
                         defaultValue:"true"
                     },{
                    	 name: "transfer",
                         type: "radio",
                         label: "可转让",
                         list: [{
                             key: "true",
                             value: "是"
                         }, {
                             key: "false",
                             value: "否"
                         }],
                         defaultValue:"true"
                     },{
                    	 name: "isExtends",
                         type: "radio",
                         label: "可继承",
                         list: [{
                             key: "true",
                             value: "是"
                         }, {
                             key: "false",
                             value: "否"
                         }],
                         defaultValue:"true"
                     },{
                    	 name: "lendable",
                         type: "radio",
                         label: "可借出",
                         list: [{
                             key: "true",
                             value: "是"
                         }, {
                             key: "false",
                             value: "否"
                         }],
                         defaultValue:"true"
                     },{
                    	 name: "renewable",
                         type: "radio",
                         label: "可续签",
                         list: [{
                             key: "true",
                             value: "是"
                         }, {
                             key: "false",
                             value: "否"
                         }],
                         defaultValue:"true"
                     },{
                    	 name: "sales",
                         type: "radio",
                         label: "是否促销",
                         list: [{
                             key: "true",
                             value: "是"
                         }, {
                             key: "false",
                             value: "否"
                         }],
                         defaultValue:"false"
                     },{
 						name:"description",
 						type:"textarea",
 						label:"备注",
 						"break":true
                     }]
                 }
            });
            widget.set("form", component);
        }
    };
    module.exports = instance;
});
